<?php

namespace App\Listeners;

class UserEventListener
{
    /**
     * Handle user login events.
     */
    public function onUserLogin($event) 
    {
        $event->loginnum++;

        $event->save();
    }

    /**
     * Handle user logout events.
     */
    public function onUserLogout($event) 
    {
         // dd($user);
    }

    /**
     * Register the listeners for the subscriber.
     *
     * @param  Illuminate\Events\Dispatcher  $events
     */
    public function subscribe($events)
    {
        $events->listen('auth.login', 'App\Listeners\UserEventListener@onUserLogin');

        $events->listen('auth.logout', 'App\Listeners\UserEventListener@onUserLogout');
    }

}